package com.yonghui.sandbox.service.impl;

import com.yonghui.sandbox.dto.UserDTO;
import com.yonghui.sandbox.service.UserService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Value;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @description: TODO
 * @author: zhangtong
 * @create: 2021-03-10 15:16
 **/
@DubboService(version = "1.0.0")
public class UserServiceImpl implements UserService {

    @Value("${dubbo.application.name}")
    private String serviceName;

    @Override
    public List<UserDTO> findList(String name) {
        System.out.println("consumer name = " + name);
        List<UserDTO> list = new ArrayList<>();
        UserDTO userDTO1 = new UserDTO();
        userDTO1.setId(1);
        userDTO1.setName("张三");
        userDTO1.setBirthday(new Date());

        UserDTO userDTO2 = new UserDTO();
        userDTO2.setId(2);
        userDTO2.setName("李四");
        userDTO2.setBirthday(new Date());

        list.add(userDTO1);
        list.add(userDTO2);

        return list;
    }
}
